
package com.suarte.core.service.impl;

import com.suarte.core.Currency;
import com.suarte.core.ExchangeRate;
import com.suarte.core.ExchangeRateType;
import com.suarte.core.dao.ExchangeRateDao;
import com.suarte.core.service.ExchangeRateManager;
import java.util.Date;
import org.appfuse.service.impl.GenericManagerImpl;

import java.util.List;

/**
 * @date   Mar 1, 2011
 * @author Ggutierrez
 */
public class ExchangeRateManagerImpl extends GenericManagerImpl<ExchangeRate, Long> implements ExchangeRateManager {
    ExchangeRateDao exchangeRateDao;

    public ExchangeRateManagerImpl(ExchangeRateDao exchangeRateDao) {
        super(exchangeRateDao);
        this.exchangeRateDao = exchangeRateDao;
    }

    public ExchangeRate findByDate(Date date, Currency fromCurrency, Currency toCurrency, ExchangeRateType type) {
        return exchangeRateDao.findByDate(date, fromCurrency, toCurrency, type);
    }

    public List<ExchangeRate> findRates(Date date, Currency fromCurrency, Currency toCurrency, ExchangeRateType type) {
        return exchangeRateDao.findRates(date, fromCurrency, toCurrency, type);
    }
}
